package tools

import (
	"encoding/gob"
	"log"
	"os"
)

func ResolvePublickey(filename string) string {
	predepub, err := os.Open(filename)
	if err != nil {
		log.Fatal(err)
	}
	defer predepub.Close()

	var pub PublicKey
	decoder := gob.NewDecoder(predepub)
	err = decoder.Decode(&pub)
	if err != nil {
		log.Fatalf("Error decoding: %v", err)
	}
	hexStr1 := pub.X.Text(16)
	hexStr2 := pub.Y.Text(16)
	return hexStr1 + "," + hexStr2
}
